package com.example;

import com.example.view.MainFrame;

import java.util.*;
/**
 * @author:我叫程晓非
 * @desc:主函数类
 * @date:2021-11-07
 * @version:1.0
 */
public class Main {

//    public static void main(String[] args) {
//

//        try {
//            HashMap<String,String> devicesMap =  (HashMap<String,String>)AdbShellUtil.getAllDeviceInfo();
//            Iterator iterator = devicesMap.entrySet().iterator();
//            while (iterator.hasNext()){
//                Map.Entry entry = (Map.Entry)iterator.next();
//                System.out.println(entry.getKey().toString()+"___"+entry.getValue().toString());
//            }
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

//        System.out.println(res);
//        int i=9927;
//        while(true){
//            i++;
//            AdbShellUtil.getDeviceScreenshot(i+"");
//            String res = AdbShellUtil.executeShell2("adb shell input swipe 800 800 10 800");
//            System.out.println(i+":"+res);
//            try {
//                Thread.sleep(1000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }





//    }






    //1.回溯法相关数据结构
    public static int[] numbers = {0,1,2,3,4,5,6,7,8};
    public static Set<Integer> used = new HashSet<>();
    public static Deque<Integer> deque = new ArrayDeque<>();
    /**
     * @desc 计算所有排列
     */
    public static void backtrack(Deque<Integer> deque,int depth){
        //2.终止条件
        if(depth == 2){
            //3.打印结果 or 存储结果 并返回
            Iterator<Integer> iterator = deque.iterator();
            while(iterator.hasNext()){
                int t = iterator.next();
                System.out.print(t+"\t");
            }
            System.out.println();
            return;
        }
        //3.遍历元素
        for(int i=0;i<numbers.length;i++){
            //4.判断条件(根据题目要求判断元素能否被压入队列中)
            if(!used.contains(numbers[i])){
                //5.压入操作
                used.add(numbers[i]);
                deque.addLast(numbers[i]);
                //6.递归操作
                backtrack(deque,depth+1);
                //7.还原操作
                used.remove(numbers[i]);
                deque.removeLast();
            }
        }
    }

    public static void main(String[] args) {
        MainFrame mf = new MainFrame("【一笔画辅助工具】版本1.0 作者:我叫程晓非");
        //ArrayList<ArrayList<Integer>> res = MainFrame.combine_backtrack((this.yibihuaGraph.getRow()+1)*(this.yibihuaGraph.getCol()+1),2);
    }

}
